module.exports = {
  lintOnSave: true,
  productionSourceMap: false,
  publicPath: process.env.NODE_ENV === 'production' ? '/admin/' : '/',
  chainWebpack: (config) => {
    //忽略的打包文件
    config.externals({
      'vue': 'Vue',
      'vue-router': 'VueRouter',
      'vuex': 'Vuex',
      'axios': 'axios',
      'element-ui': 'ELEMENT',
    })
    const entry = config.entry('app')
    entry
      .add('babel-polyfill')
      .end()
    entry
      .add('classlist-polyfill')
      .end()
    entry
      .add('@/mock')
      .end()
  },
  devServer: {
    // 端口配置
    port: 8012,
    host: '0.0.0.0',
    // 反向代理配置
    proxy: {
      // '/api': {
      //   target: 'http://114.55.103.41:8012/api',
      //   ws: true,
      //   pathRewrite: {
      //     '^/api': ''
      //   }
      // },
      '/api': {
        // target: 'http://101.200.243.78:9012/api',
        // target: 'http://8.142.153.155:9012/api',
        // target: 'http://8.142.153.155:9012/api',
        target: 'https://flower.bjsgcs.com/api',
        // target: 'http://8.142.153.155:9010/api',
        // target: 'http://8.142.153.155:9014/api',
        // target: 'http://114.55.103.41:8012/wt_api',
        // target: 'http://192.168.1.146:8024',
        ws: true,
        pathRewrite: {
          '^/api': ''
        }
      },
      '/echartsApi': {
        // target: 'http://8.142.153.155:9012/api',
        target: 'https://flower.bjsgcs.com',
        // target: 'http://8.142.153.155:9010/api',
        // target: 'http://8.142.153.155:9014/api',
        // target: 'http://114.55.103.41:8012/wt_api',
        // target: 'http://192.168.1.146:8024',
        ws: true,
        pathRewrite: {
          '^/echartsApi': ''
        }
      },
      '/tempDownlaod': {
        target: 'https://ossdata.kaibujiaoyu.com',
        changeOrigin: true,
        pathRewrite: {
          '^/tempDownlaod': ''
        }
      }
    }
  }
}
